<?php 
require 'dbconnect.php';

if($_POST['password']!= $_POST['password2']){
header("Location: registration.php");
}
else{
$username = $_POST['username'];
$password = $_POST['password'];
$name = $_POST['fname']. " " . $_POST['lname'];
$ssn = $_POST['ssn'];
$email = $_POST['email'];
$phone = $_POST['phone'];

mysql_query("INSERT INTO Student( StudentName, StudentSSN, StudentEmail, StudentPhone, username, password) VALUES ('$name', '$ssn', '$email', '$phone', '$username', '$password')") or die(mysql_error());
$id = mysql_insert_id();
mysql_query("INSERT INTO user SELECT username, password, access FROM Student WHERE StudentID = $id");
header("Location: index.php");
}


?>